<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<Stimulus360.Controllers.Projects.ProjectDetailViewModel>" %>

<%@ Import Namespace="System.Globalization" %>
<%@ Import Namespace="Stimulus360.Controllers" %>
<%@ Import Namespace="Stimulus360.Models.Data" %>
<%@ Import Namespace="Stimulus360.Models.Data.CustomTypes" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <%
        Project project = Model.Project;
        ProjectSummary projectSummary = new ProjectSummary
                                            {
                                                ProjectId = project.ProjectId,
                                                VolunteersRequired = project.VolunteersRequired
                                            };
        
        RatingViewModel ratingViewModel = new RatingViewModel
                                              {
                                                  Id = project.ProjectId,
                                                  AverageRating = project.AverageRating.GetValueOrDefault(0),
                                                  IsDisabled = true, 
                                                  IdeaId=project.ProjectId
                                              };  %>
        <!-- Left Col Start -->
        <%Html.RenderPartial("ProjectDetailLeftNavigation", projectSummary); %>
        <!-- Left Col Ends -->
        <!-- Main Area Start -->
        <div class="mainInner colViewHdr">
            <div>
            <div class="projListItem floatLeft p10">
                <h1><%=Html.Encode(project.Title) %></h1>
                <div class="projStatusBar mt10">
                    <div class="pt02">
                        <%=project.DateCreated.ToString("D", CultureInfo.CreateSpecificCulture("en-US"))%> | PM: <%=project.UserProfile.UserName %>
                    </div>
                    <div class="projStatus pt05">
                        <div><%Html.RenderPartial("Rating", ratingViewModel); %></div>
                        <div class="separatorR">(<%=project.UserRatingsCount.GetValueOrDefault(0)%>)</div>
                        <div class="separatorR pt02">Favorites <%=project.FavoritesCount.GetValueOrDefault(0) %></div>
                        <div class="separatorFav pt02">
                            <div class="facebook" title="Facebook"><%=Html.Image("facebook_logo.png", "Facebook")%></div>
                            <div class="twitter" title="Twitter"><%=Html.Image("twitter logo.png", "Twitter")%></div>
                            <div class="digg" title="Digg"><%=Html.Image("digg.png", "Digg")%></div>
                         </div>
                    </div>
                </div>
            </div>
            <div class="floatRight">
                <div class="floatLeft projHdPic">
                    <img src="<%=Url.Action("UserImage", "Projects", new {userName=Model.Project.UserProfile.UserName})%>" alt="Project Manager" title="<%=Model.Project.UserProfile.UserName%>" />
                </div>
                <div class="floatLeft projHdProfile mt10">
                    <strong>Project Manager</strong><br />
                    <strong><%=project.UserProfile.UserName%></strong><br />
                    <%=project.UserProfile.Email%>
                </div>
            </div>
            <br clear="all" />
            </div>
            
            <div>
            <div class="projColLeft">
                <div class="projItembg p10">
                    <div class="floatLeft pt02">
                        <strong>Status: </strong>&nbsp;<%= Html.Image(project.StatusString.ToLower() + ".png", project.StatusString)%> <%= project.StatusString %></div>
                    <br clear="all" />
                </div>
                <div class="projItembg p10">
                    <div class="floatLeft">
                        <strong>Category: </strong><%=project.InvestmentCategory.Category%></div>
                    <br clear="all" />
                </div>
                <div class="projItembg p10">
                    <div class="floatLeft">
                        <strong>Volunteer Required: </strong><%=project.VolunteersRequired ? "Yes" : "No" %></div>
                    <br clear="all" />
                </div>
                <div class="projItembg p10">
                    <div class="floatLeft"><%= Html.Image("dollarIcon.png", "Estimated Spend")%></div>
                    <div class="floatLeft"><strong>Estimated Spend: </strong>$<%= decimal.Round(project.EstimatedSpend.GetValueOrDefault(0),2)%></div>
                    <br clear="all" />
                </div>
                <div class="projItembg p10">
                    <div class="floatLeft"><%= Html.Image("dollarIcon.png", "Actual Spend")%></div>
                    <div class="floatLeft"><strong>Actual Spend: </strong>$<%= decimal.Round(project.ActualSpend.GetValueOrDefault(0), 2) %></div>
                    <br clear="all" />
                </div>
                <div class="projItembg p10">
                    <div class="floatLeft"><%= Html.Image("dateIcon.png", "Start Date")%></div>
                    <div class="floatLeft">
                        <strong>Start Date: </strong>
                        <%=(!project.StartDate.HasValue)
                          ? "NA"
                          : (project.StartDate.Value == DateTime.MinValue)
                                ? "NA"
                                : project.StartDate.Value.ToString("D",
                                                                   CultureInfo.CreateSpecificCulture("en-US")) 
                        %>
                    </div>
                    <br clear="all" />
                </div>
                <div class="projItembg p10">
                    <div class="floatLeft"><%= Html.Image("dateAlrmIcon.png", "Projected End date")%></div>
                    <% if (project.Status == 1) //*** Condition to check the Completed Status...
                       {%>
                        <div class="floatLeft">
                        <strong>End date: </strong>
                        <%=(!project.ActualEndDate.HasValue)
                          ? "NA"
                          : (project.ActualEndDate.Value == DateTime.MinValue)
                                ? "NA"
                                : project.ActualEndDate.Value.ToString("D",
                                                                          CultureInfo.CreateSpecificCulture("en-US"))
                        %>
                    </div>
                    <%} else { %>
                        <div class="floatLeft">
                        <strong>Projected End date: </strong>
                        <%=(!project.EstimatedEndDate.HasValue)
                          ? "NA"
                          : (project.EstimatedEndDate.Value == DateTime.MinValue)
                                ? "NA"
                                : project.EstimatedEndDate.Value.ToString("D",
                                                                          CultureInfo.CreateSpecificCulture("en-US"))
                        %>
                    </div>
                    <%} %>
                    <br clear="all" />
                </div>
                <div class="projItembg p10">
                    <div class="floatLeft"><%= Html.Image("userGrupIcon.png", "Jobs created")%></div>
                    <div class="floatLeft"><strong>Jobs created: </strong><%=project.NewJobsCount.GetValueOrDefault(0)%></div>
                    <br clear="all" />
                </div>
            </div>
            <div class="projColRight projListItemBg p10">
                <h4>Project Description</h4>
                <br />
                <p><%=Html.Encode(project.Description) %></p>
            </div>
            </div>
            <br clear="all" />  
            <br />
             <!-- Related Ideas Start -->
            <div id="relatedIdeasContainer">
                <%Html.RenderPartial("RelatedProjects", Model.RelatedProjects ); %>
            </div>
            <!-- Related Ideas End -->
            <br />
        </div>
        <br clear="all" />
    <!-- Main Area End -->
    <!-- Popup div for showing not service not available message -->
    <div id="windowElementDemo" class="myOwnStuff" style="display: none;">
        <div class="jqalert-container">
            <div class="jqalert">
                <div class="jqalert-title" style="background-color: Blue; color: White;"></div>
                <div class="jqalert-icon"></div>
                <div class="jqalert-message"></div>
                <div class="jqalert-buttons">
                    <button onclick="window.jqalerter.closeVirtualWindow(this.parentNode.parentNode.parentNode);">OK</button>
                </div>
            </div>
        </div>
    </div>
    <!-- Popup div end -->
    <script type="text/javascript" language="javascript">
        $(document).ready(function() {
            $("#summaryTag").addClass("selected");
        });
    </script>
</asp:Content>
